package com.hliushi.learn.controller;

import com.hliushi.learn.config.MicroServiceUrl;
import com.hliushi.learn.response.JsonResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ConfigController
 * @Description TODO
 * @Author hliushi
 * @Date 2021/7/5 22:09
 * @Version V1.0
 **/
@RestController
@RequestMapping("/config")
public class ConfigController {

    private static final Logger LOGGER = LoggerFactory.getLogger(ConfigController.class);

    @Value("${url.orderUrl}")
    private String orderUrl;


    @Autowired
    private MicroServiceUrl microServiceUrl;

    /**
     * @param
     * @return
     */
    @RequestMapping("/print")
    public JsonResult<String> testConfig() {
        LOGGER.info("=====获取的订单服务地址为：{}", orderUrl);
        LOGGER.info("=====获取用户服务地址为: {}", microServiceUrl.getUserUrl());
        LOGGER.info("=====获取购物车服务地址为: {}", microServiceUrl.getShoppingUrl());
        return new JsonResult<>();
    }
}
